<%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%
    String path =request.getContextPath();
    String basepath=request.getScheme()+"//"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html lang="en">
<head>
    <base href="<%=basepath%>">
    <title>网上查询步骤之三</title>
</head>
<body>
<%@include file="top.html"%>
<%
    String namesex=(String) session.putValue("namesex");
    String hobby[]=new String[5];
    for (int i=0;i<hobby.length;i++){
        //new数组中存储了受访者的选择
        String param="hobby"+i;
        String getparam=request.getParameter(param);
        if(getparam!=null){
            hobby[i]=new String(getparam.getBytes("ISO-8859-1"),"UTF_8");
            synchronized (application){
                Integer count=(Integer) application.getAttribute(param);
                if(count==null)
                    count=new Integer(count.intValue()+1);
                application.setAttribute(param,count);
            }
        }
    }
%>
<p>
    <%=(String) session.getAttribute("namesex")%>
    ，你所感兴趣的业余爱好如下:
</p>
for(int i=0;i<hobby.length ; i++)
                           if(hobby[i]!="null"){
                           out.print("<p>");
                           out.print(hobby[i]);
                           out.print("</p>");
}
String hobbyname[]={"电影欣赏","阅读书籍","体育运动","户外旅游","流行音乐"}
for(int i=0;i<hobby.length;i++){
Integer count=(Integer)application.getAttribute("hobby"+i);
if(count==null)
count=new Integer(0);
out.println("<p>选择“+hobbyname[i]+"的人次为”+count+"</p>;
}
%>
</body>
</html>